﻿@model SelfManagement.Web.Models.ViewModels.UserHomePageViewModel
@{
    var userInfo = Model.UserInfo;
}

@section Styles{

    <link href="~/assets/css/pages/about-us.css" rel="stylesheet" type="text/css" />
}

<div class="row thumbnails">
    <div class="col-md-9">
        <div class="portlet box light-grey">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i>每日计划
                </div>
                <div class="actions">
                    <a href="@Url.Action("CreateOrEdit", "Daily")" name="options" class="toggle btn btn-success btn-sm active"><i class="fa fa-plus"></i>新建计划</a>
                </div>
            </div>
            <div class="dataTables_wrapper form-inline">
                <div class="table-scrollable">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>
                                    操作
                                </th>
                                <th>
                                    日期
                                </th>
                                <th>
                                    任务名称
                                </th>
                                <th>
                                    任务数量
                                </th>
                                <th>
                                    完成情况
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.NewestDailyItems)
                            {
                            <tr>
                                <td>
                                    <a href="@Url.Action("CreateOrEdit","Daily",new { id = item.DailyId })" class="btn btn-info btn-xs"><i class="fa fa-edit"></i>编辑</a>
                                    <a data-confirm-text="确定要删除吗？" data-confirm-button="确定" data-cancel-button="取消"
                                       data-confirmed-url="@Url.Action("Delete", "Daily", new { id = item.DailyId })"
                                       class="btn btn-danger btn-xs js-table-ajax-confirm-button">
                                        <i class="fa fa-trash-o"></i>删除
                                    </a>
                                </td>
                                <td>
                                    @item.Date.ToShortDateString()
                                </td>
                                <td>
                                    @Html.DisplayFor(m => item.TaskName)
                                </td>
                                <td>
                                    @item.TasksCount
                                </td>
                                <td>
                                    @{
                                            var statusClass = item.TaskStauts == TaskStatus.Completed ? "success" : (item.TaskStauts == TaskStatus.Deffered ? "danger" : "warning");
                                    }
                                    <a class="btn btn-@(statusClass) btn-xs"><i class="fa fa-edit"></i>@(item.TaskStauts.EnumDescription())</a>
                                </td>
                            </tr>

                                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="portlet box light-grey">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i>我的文章
                </div>
                <div class="actions">
                    <a href="@Url.Action("CreateOrEdit", "Article")" name="options" class="toggle btn btn-success btn-sm active"><i class="fa fa-plus"></i>新增文章</a>
                </div>
            </div>
            <div class="portlet-body">

                <div class="dataTables_wrapper form-inline">
                    <div class="table-scrollable">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>
                                        操作
                                    </th>
                                    <th>
                                        标题
                                    </th>
                                    <th>
                                        发表时间
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in Model.NewestArticleItem)
                                {
                                <tr>
                                    <td>
                                        <a href="@Url.Action("CreateOrEdit","Article",new { id = item.ArticleId })" class="btn btn-info btn-xs"><i class="fa fa-edit"></i>编辑</a>
                                        <a data-confirm-text="确定要删除吗？" data-confirm-button="确定" data-cancel-button="取消"
                                           data-confirmed-url="@Url.Action("Delete", "Article", new { id = item.ArticleId })"
                                           class="btn btn-danger btn-xs js-table-ajax-confirm-button">
                                            <i class="fa fa-trash-o"></i>删除
                                        </a>
                                    </td>
                                    <td>
                                        <a href="@Url.Action("Detail", "Article", new { id = item.ArticleId })">@item.Title</a>
                                        @if (item.IsTop)
                                            {
                                            <span class="btn btn-danger btn-xs margin-left-10">置顶</span>
                                            }
                                    </td>
                                    <td>
                                        @item.PublishTime.ToLocalYYYYMMDDHHmmss()
                                    </td>
                                </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-3">

        <div class="portlet box light-grey">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-user"></i>个人信息
                </div>
                <div class="actions">
                    
                    <a href="@Url.Action("MyProfile", "Account")" name="options" class="toggle btn btn-success btn-sm active"><i class="fa fa-pencil"></i>编辑</a>
                </div>
            </div>
            <div class="portlet-body">
                <div class="meet-our-team">
                    <h3>@userInfo.UserName <small>@userInfo.Identity</small></h3>
                    <img src="@Url.Content(userInfo.UserFacee  ?? (ViewBag.DefaultUserFaceImagePath as string))" alt="" class="img-responsive text-center">
                    <div class="team-info">
                        <p>
                            @userInfo.PersonalInfo
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

